package com.insigma.business.qrcode.soldier.util;


import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.symmetric.SymmetricCrypto;

public class Sm4Util {

    final static String key = "tyjrjdlkrysjcxjk";

    static SymmetricCrypto sm4 =  SmUtil.sm4(key.getBytes());

    //加密为16进制，也可以加密成base64/字节数组
    public static String encryptSm4(String plaintext) {
        return sm4.encryptHex(plaintext);
    }

    //解密
    public static String decryptSm4(String ciphertext) {
        return sm4.decryptStr(ciphertext);
    }
}
